/*****************************************************************
 * this program performs that it reverse a string,for example,
 *
 * string = "Hello World! This is C Programming.";
 * ReverseString(string);
 * string = ".gnimmargorP C si sihT !dlroW olleH";
 *
 * date:	2015|11|23
 * author:	laishaofa@gmail.com
 *****************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void ReverseString(char* str);

int main()
{
    char str[] = "Hello World! This is C Programming.";

    printf("Original string:\t%s\n",str);
    ReverseString(str);
    printf("Reversed string:\t%s\n",str);

    return 0;
}

void ReverseString(char* str)
{
    int len = strlen(str);
    int i = 0;
    char ch = 0;

    for(i=0; i<len/2; i++)
    {
        ch = *(str+i);
        *(str+i) = *(str+len-1-i);
        *(str+len-1-i) = ch;
    }
}
